////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                            //
//                                                         WNProject                                                          //
//                                                                                                                            //
//            This file is distributed under the BSD 2-Clause open source license. See License.txt for details.               //
//                                                                                                                            //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#ifndef __WN_EXPRESSION_LIST_H__
#define __WN_EXPRESSION_LIST_H__

// This is included because of a bug in VS2008 (It generated the wrong vtable size for WNScriptingEngine)
// IT does not need to be included otherwise
// 
#include "WNCore/inc/WNBase.h"

#if defined _WN_WINDOWS && _WN_MSVC < 160000000
    #include "WNScripting/inc/WNScriptingEnginePublic.h"
#endif

#include "WNScripting/inc/WNParseNode.h"
#include "WNScripting/inc/WNTypeManager.h"

class WNExpression;

namespace llvm {
    class Value;
}

class WNExpressionList : public WNParseNode {
public:
    struct WNExpressionListVal {
        WNExpression* mExpr;
        llvm::Value* mLlvmVal;
    };

    virtual ~WNExpressionList();

    WNExpressionList(WN_SIZE_T _startLine,
                     WN_SIZE_T _endLine,
                     WN_SIZE_T _startChar,
                     WN_SIZE_T _endChar,
                     WNExpression* _expr);

    WNExpressionList(WN_SIZE_T _startLine,
                     WN_SIZE_T _endLine,
                     WN_SIZE_T _startChar,
                     WN_SIZE_T _endChar,
                     WNExpressionList* _exprList,
                     WNExpression* _expr);

    llvm::Value* OptimizeAndGenerate(WNScriptingEngineData& _scriptingData, WNFunctionDecl* _functionDecl);
    WN_VOID GetExpressions(std::vector<WNExpressionListVal>& _outList) const;

private:
    WN_VOID OptimizeAndGeneratePrivate(WNScriptingEngineData& _scriptingData, WNFunctionDecl* _functionDecl, std::vector<WNExpressionListVal>& _fillList);
    std::vector<WNExpressionListVal> mExpressions;
    WNExpression* mExpression;
    WNExpressionList* mSubList;
};

#endif // __WN_FUNCTION_HEADER_LIST_H__